using System;
using System.Data.SqlClient;

/// <summary>
/// A class that represents a user's role in a project
/// </summary>
public class PsSpecUserPermission : IPsSpecDataReader
{
    public PsSpecUserPermission() { }

    public void Initialize(SqlDataReader reader, System.Collections.Generic.Dictionary<string, Int32> columnMappings)
    {
        this.id = reader.GetInt32(columnMappings["Id"]);
        this.project = reader[columnMappings["Project"]] as string;
        this.user = reader[columnMappings["User"]] as string;
        this.role = (PsSpecProjectRole)Enum.Parse(typeof(PsSpecProjectRole), reader[columnMappings["Role"]] as string);
    }

    public int Id
    {
        get { return id; }
        set { id = value; }
    }
    private int id;

    public string Project
    {
        get { return project; }
        set { project = value; }
    }
    private string project;

    public string User
    {
        get { return user; }
        set { user = value; }
    }
    private string user;

    public PsSpecProjectRole Role
    {
        get { return role; }
        set { role = value; }
    }
    private PsSpecProjectRole role;
}
